package br.com.hhc.sample.fullstackspringhibernate.database.data.domain;

// Generated 18/03/2015 07:46:00 by Hibernate Tools 4.3.1


import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Student generated by hbm2java
 */
@Entity
@Table(name = "STUDENT")
public class Student implements java.io.Serializable {
	
	private static final long serialVersionUID = 1L;

	private Integer id;
	private String name;
	private String email;
	private Date birthday;
	private Date registrationDate;
	private char status;
	private byte[] picture;
	private Set<StudentClasses> studentClasseses = null;

	public Student() {
	}

	//http://stackoverflow.com/questions/12975279/derby-sequence-loop-in-junit-test
	@Id
	@Column(name = "STUDENT_ID", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STUDENT_ID")
	@SequenceGenerator(name = "SEQ_STUDENT_ID", sequenceName = "SEQ_STUDENT_ID", allocationSize=1, initialValue=1)
	//@org.hibernate.annotations.GenericGenerator(name="SEQ_STUDENT_ID", strategy = "sequence",  parameters = { @org.hibernate.annotations.Parameter(name="sequence", value="SEQ_STUDENT_ID") } )	
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer studentId) {
		this.id = studentId;
	}

	@Column(name = "STUDENT_NAME", nullable = false, length = 256)
	public String getName() {
		return this.name;
	}

	public void setName(String studentName) {
		this.name = studentName;
	}

	@Column(name = "STUDENT_EMAIL", nullable = false, length = 256)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String studentEmail) {
		this.email = studentEmail;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "STUDENT_BITHDAY", nullable = false, length = 7)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date studentBithday) {
		this.birthday = studentBithday;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "STUDENT_REGISTRATION_DATE", nullable = false, length = 7)
	public Date getRegistrationDate() {
		return this.registrationDate;
	}

	public void setRegistrationDate(Date studentRegistrationDate) {
		this.registrationDate = studentRegistrationDate;
	}

	@Column(name = "STUDENT_STATUS", nullable = false, length = 1)
	public char getStatus() {
		return this.status;
	}

	public void setStatus(char studentStatus) {
		this.status = studentStatus;
	}

	@Lob
	@Column(name = "STUDENT_PHOTO")
	public byte[] getPhoto() {
		return this.picture;
	}

	public void setPhoto(byte[] studentPhoto) {
		this.picture = studentPhoto;
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "student")
	public Set<StudentClasses> getClasseses() {
		return this.studentClasseses;
	}

	public void setClasseses(Set<StudentClasses> studentClasseses) {
		this.studentClasseses = studentClasseses;
	}
	
	

}
